package com.zm.demo.shoppingmall.storage.service.impl;

import com.zm.demo.shoppingmall.storage.api.StorageService;
import com.zm.demo.shoppingmall.storage.dao.TStorageMapper;
import com.zm.demo.shoppingmall.storage.model.TStorage;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.time.LocalDateTime;

/**
 * @desc:
 * @author: z01140
 * @date: 2021/5/25 10:03
 */
@DubboService
public class StorageServiceImpl implements StorageService {

    @Autowired
    private TStorageMapper storageMapper;

    @Override
    public int addStorage(TStorage storage) {
        return storageMapper.insertSelective(storage);
    }

    @Override
    public int updateStorage(TStorage storage) {
        return storageMapper.updateByPrimaryKeySelective(storage);
    }

    @Override
    public int deleteStorageById(int storageId) {
        return storageMapper.deleteByPrimaryKey(storageId);
    }

    @Override
    public TStorage getStorageById(int storageId) {
        return storageMapper.selectByPrimaryKey(storageId);
    }

    @Override
    public TStorage getStorageByProductNo(String productNo, LocalDateTime date) {
        return storageMapper.getStorageByProductNo(productNo, date);
    }
}
